package com.shenjinzheng.apply.controller;

import com.shenjinzheng.apply.dto.MerchantApplyDTO;
import com.shenjinzheng.apply.entity.MerchantApply;
import com.shenjinzheng.apply.service.MerchantApplyService;
import com.shenjinzheng.common.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 商家入驻申请表 前端控制器
 * </p>
 *
 * @author shenjinzheng
 * @since 2024-11-10
 */
@Tag(name = "商户管理", description = "商户入驻申请和审批相关接口")
@RestController
@RequestMapping("/merchantApply")
public class MerchantApplyController {

    @Resource
    private MerchantApplyService merchantApplyService;

    @PostMapping
    @Operation(summary = "商户入驻申请")
    public Result<Object> apply(@RequestBody MerchantApply merchantApply){
        merchantApplyService.apply(merchantApply);
        return Result.success();
    }

    @PutMapping
    @Operation(summary = "商户入驻审批")
    public Result<Object> approval(@RequestBody MerchantApplyDTO merchantApplyDTO){
        merchantApplyService.approval(merchantApplyDTO);
        return Result.success();
    }
}
